home *** CD-ROM | disk | FTP | other *** search
/ BBS Toolkit / BBS Toolkit.iso / doors_2 / twview93.zip / CONVERT.PAS < prev    next >
Pascal/Delphi Source File  |  1992-06-18  |  4KB  |  144 lines

  1. { Part one will parse a log file, and store explored sectors; then
  2. create a text file that you can feed to the computer that will give you
  3. a map of the universe.  Part two will take a log file generated from
  4. feeding the first to the computer, and create a data file that can
  5. be fed into something else.
  6.  
  7. Well, this has been expanded a bit since the first note.  It now does
  8. a variety of conversion tasks, from fighter clouds to major space lane stuff.
  9. But that is always the problem with programs -- they always outstrip the
  10. documentation, eh?  Program begun Dec 1990 by woody.
  11. }
  12.  
  13. { I keep forgetting to turn off 286 instruction set.  So, better force it
  14.   off here, before I confuse any more 286 people. }
  15. {$A+}        { speed up us 80x86 guys }
  16. {$B-}        { I dig short circuits }
  17. {$I+}        { pisses people off when they hit a letter, but its better than
  18.                gigo. }
  19. {$G-}        { turn OFF 286 instruction set }
  20.  
  21.  
  22. program converter;
  23.  
  24. {$I headers.inc}
  25.  
  26.  
  27. var
  28.   upl,
  29.   ext,
  30.   mss       : string;
  31.   othername,
  32.   BBSName   : string;
  33.   ch        : char;
  34.   n         : integer;
  35.   f, g      : text;
  36.   space     : TheVoid;
  37.  
  38. {$I QUEUE.INC }
  39. {$I status.inc }
  40. {$I misc.inc }
  41. {$I PortStat.inc }
  42. {$I gsdata.inc }
  43. {$I part13.inc}
  44. {$I part2.inc}
  45. {$I part4.inc}
  46. {$I part5.inc}
  47. {$I part6.inc}
  48. {$I part89.inc}
  49. {$I editbase.inc}
  50.  
  51. begin {main}
  52.   writeln('Tradewars Data Base generator: ', Version);
  53.   writeln( author );
  54.   writeln( source );
  55.   writeln;
  56.   InitSpace( Space );
  57.   if paramcount > 0 then
  58.     BBSName := paramstr( 1 )
  59.   else
  60.     BBSName := '';
  61.   GetData( space, BBSName );
  62.   repeat
  63.     repeat
  64.       writeln('Choices:');
  65.       writeln('  (0)  Let me out of here!');
  66.       writeln('  (1)  Read "Explored/Unexplored Sectors"',
  67.               'for newly scanned sectors');
  68.       writeln('  (2)  Read log files for inter-warp and port information');
  69.       writeln('  (3)  Read "Fighter Display" list for fighter clouds');
  70.       writeln('  (4)  Generate upload file for determining Major Space Lanes');
  71.       writeln('  (5)  Read "Major Space Lanes" downloaded file into database');
  72.       writeln('  (6)  Add some other explorer''s data into database');
  73.       writeln('  (7)  Perform editing on data base');
  74.       writeln('  (8)  Read "Interrogation Mode" sector report');
  75.       writeln('  (9)  Read "Interrogation Mode" port report');
  76.       writeln;
  77.       write('(', BBSname, ')  Your choice?  (0, 1, ..., 9) ');
  78.       readln( ch );
  79.     until ch in ['0'..'9'];
  80.     n := ord( ch ) - ord( '0' );
  81.     if n = 0 then halt;
  82.     upl := 'dat';
  83.     case n of
  84.       1 : begin
  85.             mss := '"Explored/Unexplored Sectors"';
  86.             ext := 'exp';
  87.             upl := 'upl';
  88.           end;
  89.       2 : begin
  90.             mss := 'log';
  91.             ext := 'log';
  92.           end;
  93.       3 : begin
  94.             mss := '"Deployed Fighter Scan"';
  95.             ext := 'ftr';
  96.           end;
  97.       4 : upl := 'upl';
  98.       5 : begin
  99.             mss := '"Major Space Lanes"';
  100.             ext := 'msl';
  101.           end;
  102.       6 : begin
  103.             mss :='other database';
  104.             ext := 'unk';
  105.           end;
  106.       7 : ;
  107.       8 : begin
  108.             mss := 'sector report file';
  109.             ext := 'sct';
  110.           end;
  111.       9 : begin
  112.             mss := 'port report file';
  113.             ext := 'prt';
  114.           end;
  115.     end; {case}
  116.     if not (n in [4,7]) then
  117.       begin
  118.         othername := GetOldFileName( 'Name of ' + mss + ' file?  ',
  119.                                      bbsname + '.' + ext );
  120.         if n <> 6 then
  121.           begin
  122.             assign( f, othername);
  123.             reset( f );
  124.           end; {if}
  125.       end; {if}
  126.     assign( g, GetNewFileName('Name of file to generate? ',
  127.                                 bbsname + '.' + upl) );
  128.     rewrite( g );
  129.     case n of
  130.       1 : partOneThree;
  131.       2 : partII( space);
  132.       3 : partIV( space );
  133.       4 : partV;
  134.       5 : partVI( space );
  135.       6 : begin GetData( space, othername ); SaveData( g, space ); end;
  136.       7 : begin EditMenu; SaveData( g, space ); end;
  137.       8 : partVIII( f, Space );
  138.       9 : partIX( f, Space );
  139.     end; {case}
  140.     if n in [1, 2, 3, 8, 9] then
  141.       close( f );
  142.   until n = 0;
  143. end.
  144.